import request from '@/utils/request'
// 获取员工列表
export const getEmployeeList = (params) => request({
  url: '/sys/user',
  params
})
// 导出员工
export const exportEmployee = () => request({
  url: '/sys/user/export',
  responseType: 'blob'
})
// 下载导入员工模板
export const getExportTemplate = () => request({
  url: '/sys/user/import/template',
  responseType: 'blob'
})
// 上传员工
export function uploadExcel(data) {
  return request({
    url: '/sys/user/import',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}
// 删除员工
export const remveEmployee = (id) => request({
  method: 'DELETE',
  url: `/sys/user/${id}`
})
// 新增员工
export const addEmployee = data => request({
  url: '/sys/user',
  method: 'POST',
  data
})
// 获取员工详情
export const getEmployeeDetail = id => request({
  url: `/sys/user/${id}`
})
// 修改员工信息
export const updateEmployee = data => request({
  url: `/sys/user/${data.id}`,
  method: 'PUT',
  data
})
// 获取可用角色
export const getEnableRoleList = () => request({
  url: '/sys/role/list/enabled'
})
// 分配角色权限
export const assignRole = data => request({
  url: '/sys/user/assignRoles',
  method: 'PUT',
  data
})
